<template>
    <el-container class="home-container">
    <!--头部区域-->
  <el-header>
      <div class="div-box1">
          <span class="span-box1">销售信息系统</span>
      </div>
      <el-button type="info" @click="logout">退出</el-button>
    </el-header>
  <!--页面主体区域-->
  <el-container>
    <!--侧边栏-->
    <el-aside :width="isCollapse ? '64px' : '200px'">
    <div class="toggle-button" @click="togglecollapse()">|||</div>
        <el-menu
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#409BFF"
      unique-opened
      :collapse="isCollapse"
      :collapse-transition="false"
      router>
      <el-submenu index="1">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span>顾客功能</span>
        </template>
          <el-menu-item index="exorder" class="el-icon-s-grid">订单操作</el-menu-item>
          <el-menu-item index="detailed" class="el-icon-s-grid">订单细则</el-menu-item>
      </el-submenu>
      <el-submenu index="2">
        <template slot="title">
          <i class="el-icon-menu"></i>
          <span>管理员功能</span>
        </template>
          <el-menu-item index="inventory" class="el-icon-s-grid">查看库存</el-menu-item>
          <el-menu-item index="factory" class="el-icon-s-grid">查看工厂</el-menu-item>
      </el-submenu>
    </el-menu>
    </el-aside>
    <!--右侧内容主题-->
    <el-main>
      <!--路由重定向-->
      <router-view></router-view>
    </el-main>
  </el-container>
</el-container>
</template>

<script>
export default {
    data(){
      return{
        isCollapse: false
      }
    },
    methods:{
        logout(){
            window.sessionStorage.clear()
            this.$router.push('/login')
        },
        togglecollapse(){
          this.isCollapse = !this.isCollapse
        }
    }
}
</script>

<style>
.home-container{
    height: 100%;
}
.el-header{
    background-color: cadetblue;
    display: flex;
    justify-content: space-between;
    padding-left: 0;
    align-items: center;
    color:#fff;
    font-size: 20px;
}
.el-aside{
    background-color:#696969;
    border-right: none;
}
.el-main{
    background-color: #e4ece4;
}
.div-box1{
    display: flex;
    align-items: center;
}
.span-box1{
    margin-left: 15px;
}
.toggle-button{
  background-color: #4a5064;
  font-size: 10px;
  line-height: 24px;
  color:#fff;
  text-align: center;
  letter-spacing: 0.2em;
  cursor: pointer;
}
</style>